#include "daemon.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void daemon_free(daemon_t *d) {
  free(d->deps);
  free(d->launch_command);
  printf("freed daemon with name \"%s\"\n", d->name);
  free(d->name);
  free(d);
}

void daemon_deep_copy(daemon_t *into, daemon_t *from) {
  into->name = (char *)malloc(sizeof(char) * strlen(from->name) + 1);
  into->deps = (char *)malloc(sizeof(char) * strlen(from->deps) + 1);
  into->launch_command =
      (char *)malloc(sizeof(char) * strlen(from->launch_command) + 1);

  strcpy(into->name, from->name);
  strcpy(into->deps, from->deps);
  strcpy(into->launch_command, from->launch_command);
}
